<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <script type="text/javascript">
        	window.onload = function(){
        		function $(id){ return document.getElementById(id)}

        		$("btn").onclick = function(){
        			if($("txt").value == "刘德华"){
        				alert("恭喜")
        			}else{
        				alert("查无此人")
        			}
        		}
        	}
        </script>
    </head>
    <body>
    	<input type="text" id="txt" value="请输入....." /> <button id="btn">查询</button>
    </body>
</html>